package com.aaa.service.sds.impl;


import com.aaa.dao.sds.SdsDao;
import com.aaa.entity.system.PageEnty;
import com.aaa.entity.sds.Sds;
import com.aaa.service.sds.SdsService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 问题表(Sds)表服务实现类
 *
 * @author makejava
 * @since 2022-09-01 09:23:59
 */
@Service("sdsService")
public class SdsServiceImpl implements SdsService {
    @Autowired
    SdsDao sdsDao;

    @Override
    public Page queryAllSdsPage(PageEnty pageEnty, Sds sds) {
        PageHelper.startPage(pageEnty.getPage(), pageEnty.getLimit(), pageEnty.orderBy());
        List<Map<String, Object>> mapList = sdsDao.queryAllSdsPage(sds);
        Page page = (Page) mapList;
        return page;
    }

    @Override
    public boolean saveUser(Sds sds) {
        return sdsDao.saveUser(sds);
    }

    @Override
    public boolean deleteUser(int[] id) {
        return sdsDao.deleteUser(id);
    }

    @Override
    public boolean updateUser(Sds sds) {
        return sdsDao.updateUser(sds);
    }

    @Override
    public boolean repetitionName(Sds sds) {
        Integer repetitionName = sdsDao.repetitionName(sds);
        if (repetitionName == 0) {
            return true;
        }
        return false;

    }
}
